﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using WenSkin.Controls;

namespace WenSkinTest.UserControlAll
{
    public partial class UserControlPie : WenSkin.Controls.WenUserControl
    {
        public UserControlPie()
        {
            InitializeComponent();
        }

        private void wenButton1_Click(object sender, EventArgs e)
        {
            Thread thread = new Thread(new ThreadStart(() =>
              {
                  int v = 0;
                  while (true)
                  {
                      Thread.Sleep(100);
                      v++;
                      testPie1.Invoke(new Action(() =>
                      {
                          testPie1.Value = v;
                      }));
                      if (v >= 70)
                          v = 0;
                  }
              }));
            thread.Start();
            propertyGrid1.SelectedObject = testPie1;
        }

        private void wenButton2_Click(object sender, EventArgs e)
        {
            double d = double.Parse(wenTextBox1.Text);

            wenTextBox2.Text = Math.Tan(Math.PI * d / 180).ToString();
            wenTextBox3.Text = Math.Tan(d).ToString();
        }

        private void wenButton3_Click(object sender, EventArgs e)
        {
            testPie1.SaveImage("001.png", 100, 100);
            testPie1.SaveImage("002.png");
        }

        private void wenButton4_Click(object sender, EventArgs e)
        {
          wenTextBox4.Text= WenSkin.DLL.FileFolderHelper.ReadText("1.txt");
        }

    }
}
